<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "vr_sapce".
 *
 * @property integer $id
 * @property string $name
 * @property integer $useing
 */
class VrSapce extends \yii\db\ActiveRecord
{
    const VALID_USEING = 1;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'vr_sapce';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['useing'], 'integer'],
            [['name'], 'string', 'max' => 30]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'useing' => 'Useing',
        ];
    }

    /**
     * 有效的空间
     * @return VrSapce|null
     */
    public static function getValidSpace(){
        return self::findOne(["useing"=>self::VALID_USEING]);
    }
}
